﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Products_List.aspx.cs" Inherits="WL_Store.Web.subpage.Products_List" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../assets/css/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="../css/style.css" />
    <link rel="stylesheet" href="../assets/css/ace.min.css" />
    <link rel="stylesheet" href="../assets/css/font-awesome.min.css" />
    <link rel="stylesheet" href="..Widget/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css" />
    <link href="../Widget/icheck/icheck.css" rel="stylesheet" type="text/css" />
    <!--[if IE 7]>
		  <link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
		<![endif]-->
    <!--[if lte IE 8]>
		  <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
		<![endif]-->
    <script src="../js/jquery-1.9.1.min.js"></script>
    <script src="../assets/js/bootstrap.min.js"></script>
    <script src="../assets/js/typeahead-bs2.min.js"></script>
    <!-- page specific plugin scripts -->
    <script src="../assets/js/jquery.dataTables.min.js"></script>
    <script src="../assets/js/jquery.dataTables.bootstrap.js"></script>
    <script type="text/javascript" src="../js/H-ui.js"></script>
    <script type="text/javascript" src="../js/H-ui.admin.js"></script>
    <script src="../assets/layer/layer.js" type="text/javascript"></script>
    <script src="../assets/laydate/laydate.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Widget/zTree/js/jquery.ztree.all-3.5.min.js"></script>
    <script src="../js/lrtk.js" type="text/javascript"></script>
    <script src="../My97DatePicker/WdatePicker.js"></script>
    <title>产品详情</title>
    <style>
        th {
            text-align: center;
        }

        .add_name span {
            color: red;
        }

        #gv_Com tr {
            height: 40px;
        }
        /*#tb_product  th {
            text-align: center;
            background-color:aquamarine;
             
        }*/

        .add_name span {
            color: red;
        }
        /*#tb_product td{
        padding:4px;
        
         text-align:center;
        }
        #tb_product tr {
        height:40px;
       
        background-color:#f0ceff;
        }
      
        #tb_product {
        border-collapse:collapse;
        margin:0 auto;
        width:1300px;
        }*/
        .page {
            margin: 0 auto;
            display: block;
            margin-top: 12px;
        }
        strong{
        color:#e4393c;
        }
       
    </style>
   
    <script>
        $(function () {
         //加载层-风格3
            layer.ready(function () {
                layer.load(2, { time: 0.5 * 1000 });
            });
            //重置按钮事件
            $('#btn_clear').click(function () {
                ClearText();
            });

            //当你在iframe页面关闭自身时
            //var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            //再执行关闭 

            //点击编辑事件
            $('.edit').click(function () {
                var commodityID = $(this).attr("editId");
                layer.open({
                    type: 2,
                    load: 2,
                    area: ['900px', '600px'],
                    fixed: false, //不固定
                    title: '修改商品',
                    maxmin: true,
                    shadeClose: true,
                    skin: 'layer-ext-moon',
                    content: 'Products_List_edit.aspx?commodityID=' + commodityID,
                    end: function () {
                        location.reload();
                    }
                });

            });
            //删除事件
            $('.delProduct').click(function () {
                var commodityID = $(this).attr("delId");
                $.post("/ashx/Product_List.ashx", 
                    { commodityID: commodityID, Action: "DelProduct" },
                    function(data) {
                        
                        layer.confirm('你确定要删除吗?', { icon: 3, title: '提示' }, function (index) {
                            
                                if (data.State == 1) {
                                    parent.layer.msg('删除成功！', { time: 1000, shade: 0.3 }, function () {
                                        layer.close(index);
                                        //Response.redirect("Products_List.aspx");
                                        //debugger;
                                        //location.href("Products_List.aspx");
                                        location.reload();
                                        
                                        
                                    });
                                }
                                else {
                                    
                                    parent.layer.msg('删除失败！', { time: 1000, shade: 0.3 }, function myfunction() {
                                        layer.close(index);
                                    });
                                }
                            
                        });
                    
                },"json");

            });

            //添加事件
            $('#btn_add').click(function () {
                var number = $('#txt_number').val();
                var name = $('#txt_nam').val();
                var purchase = $('#txt_purchase').val();
                var selling = $('#txt_selling').val();
                var productionPlace = $('#txt_productionPlace').val();
                var stocks = $('#txt_stocks').val();
                var quantitySold = $('#txt_quantitySold').val();
                var description = $('#txt_description').val();
                var CaId = $('#ddl_Add').val();
               
                var num = 0;
                var str = "";
                $(".add_menber input[type$='text']").each(function (n) {
                    
                    if ($(this).val() == "") {
                        debugger;
                        layer.tips("<strong>"+(str += "") + $(this).attr("lname") + "不能为空！</strong>", "#" + $(this).attr("ID"), { tips: [2, "#ffebeb"] });

                        num++;
                        return false;
                    }
                });
                if (num > 0) { return false; }
                else {
                $.post("/ashx/Product_List.ashx", {
                    number: number, name: name, purchase: purchase, selling: selling, productionPlace: productionPlace,
                    stocks: stocks, quantitySold: quantitySold, description: description, CaId: CaId, Action: "AddProduct"
                }, function (data) {
                    if (data.State==0) {
                        parent.layer.msg('已存在该商品编号！', { time: 1000, shade: 0.3 });
                        }
                    else {
                        if (data.State == 1) {
                            parent.layer.msg('添加成功！', { time: 1000, shade: 0.3 }, function () {
                                layer.close(index);
                                location.reload();
                            });
                        }
                        else {
                            parent.layer.msg('添加失败！', { time: 1000, shade: 0.3 }, function () {
                                layer.close(index);
                                location.reload();

                            });
                        }
                    }
                        
                }, "json");
                }
            })

        }); 

    </script>


</head>
<body>
    
    <form id="form1" runat="server" >
        <div class=" page-content clearfix">
            <div id="products_style">
                <div class="search_style">
                    <ul class="search_content clearfix">
                        <li>
                            <label class="l_f">商品编号:</label>
                            <asp:TextBox ID="txt_search_Id" runat="server" class="text_add" placeholder="输入商品编号" Style="width: 200px"></asp:TextBox>
                        </li>
                        <li>
                            <label class="l_f">商品名称:</label>

                            <asp:TextBox ID="txt_search_name" runat="server" class="text_add" placeholder="输入商品名称" Style="width: 200px"></asp:TextBox>
                        </li>

                        <li>
                            <label class="l_f">添加时间:</label>
                            <input id="txt_StartAddtime" runat="server" class="inline laydate-icon" onclick="WdatePicker({ isShowClear: true, readOnly: true })" />
                            <label>至</label>
                            <input id="txt_EndAddtime" runat="server" class="inline laydate-icon" onclick="WdatePicker({ isShowClear: true, readOnly: true })" />

                        </li>

                        <li>
                            <label class="l_f">商品类别:</label>
                            <asp:DropDownList ID="ddl_category" runat="server" class="text_add" Style="margin-left: 10px;"></asp:DropDownList>

                        </li>
                        <li style="width: 60px;">
                            <%--<button type="button" class="btn_search"><i class="icon-search"></i>查询</button>--%>
                            <asp:Button ID="btn_search" runat="server" Text="查询" class="btn_search" OnClick="btn_search_Click" CausesValidation="false" />
                        </li>
                    </ul>
                </div>
                <div class="border clearfix">
                    <span class="l_f">

                        <a href="javascript:ovid()" id="member_add" class="btn btn-warning"><i class="icon-plus"></i>添加商品</a>
                        <%--<a href="javascript:ovid()" class="btn btn-danger"><i class="icon-trash"></i>批量删除</a>--%>
                    </span>
                    <span class="r_f" style="">共：<b><asp:Label ID="lbl_CountProducts" runat="server" Text="Label"></asp:Label>
                    </b>件商品</span>
                </div>
                <!--产品列表展示-->
                <div class="h_products_list clearfix" id="products_list">


                    <table id="tb_product" class="table table-striped table-bordered table-hover dataTable no-footer">
                        <tr>
                            <th>商品编号</th>
                            <th style="width: 140px;">商品名</th>
                            <th>商品类别</th>
                            <th>进价</th>
                            <th>售价</th>
                            <th>产地</th>
                            <th>库存</th>
                            <th>已售数量</th>
                            <th style="width: 400px;">描述</th>
                            <th>添加时间</th>
                            <th>操作</th>

                        </tr>
                        <asp:Repeater ID="rpt_product" runat="server">
                            <ItemTemplate>
                                <tr>
                                    <td><%# Eval("commodityID") %></td>
                                    <td><%# Eval("comName") %></td>
                                    <td><%# Eval("category") %></td>
                                    <td><%# Eval("purchase") %></td>
                                    <td><%# Eval("selling") %></td>
                                    <td><%# Eval("productionPlace") %></td>
                                    <td><%# Eval("stocks") %></td>
                                    <td><%# Eval("quantitySold") %></td>
                                    <td><%# Eval("description") %></td>
                                    <td><%# Eval("addTime") %></td>

                                    <td>
                                        <a class="edit btn btn-sm btn-success" editid='<%# Eval("commodityID") %>">'><i class="icon-edit bigger-120"></i>编辑</a>
                                        <%--<asp:LinkButton ID="lbt_del" CssClass="del btn btn-sm btn-danger" runat="server" CommandName="del"
                                            CommandArgument='<%# Eval("commodityID") %>' OnCommand="lbt_del_Command" 
                                            CausesValidation="false"><i class="icon-trash  bigger-120"></i>删除</asp:LinkButton>--%>
                                        <a  class="del btn btn-sm btn-danger delProduct" delId="<%# Eval("commodityID") %>"><i class="icon-trash  bigger-120"></i>删除</a>

                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </table>
                    <div class="row" style="margin-bottom: 16px">
                        <webdiyer:AspNetPager ID="product_Pager" runat="server" UrlPaging="true" AlwaysShow="true"
                            FirstPageText="首页" LastPageText="末页"
                            NextPageText="下一页" PrevPageText="上一页" CustomInfoHTML="目前是第%CurrentPageIndex%页 / 总共%PageCount%页"
                            ShowCustomInfoSection="Right" PagingButtonSpacing="0" NumericButtonCount="5"
                            CssClass="pagination page" LayoutType="Ul" PagingButtonLayoutType="UnorderedList" CurrentPageButtonClass="active" Width="1300px" OnPageChanging="product_Pager_PageChanging" PageSize="10">
                        </webdiyer:AspNetPager>
                    </div>
                </div>

            </div>


            <!--添加商品-->
            <!--添加用户图层-->
            <div class="add_menber" id="add_menber_style" style="display: none">

                <ul class=" page-content">
                    <li>
                        <label class="label_name">商品编号：</label>
                        <span class="add_name">
                            <asp:TextBox ID="txt_number" lname="商品编号" runat="server" class="text_add" placeholder="商品编号"></asp:TextBox>
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="请输入商品编号" ControlToValidate="txt_number"></asp:RequiredFieldValidator>--%>
                        </span>
                        <div class="prompt r_f"></div>
                    </li>
                    <li>
                        <label class="label_name">商品名称：</label><span class="add_name">

                            <asp:TextBox ID="txt_nam" lname="商品名称" runat="server" class="text_add" placeholder="商品名称"></asp:TextBox>
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="请输入商品名称" ControlToValidate="txt_nam"></asp:RequiredFieldValidator>--%>
                        </span>
                        <div class="prompt r_f"></div>
                    </li>
                    <li>
                        <label class="label_name">商品进价：</label><span class="add_name">
                            <asp:TextBox ID="txt_purchase" lname="商品进价" runat="server" class="text_add" placeholder="商品进价"></asp:TextBox>
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="请输入商品进价" ControlToValidate="txt_purchase"></asp:RequiredFieldValidator>--%>
                        </span>
                        <div class="prompt r_f"></div>
                    </li>
                    <li>
                        <label class="label_name">商品售价：</label><span class="add_name">
                            <asp:TextBox ID="txt_selling" lname="商品售价" runat="server" class="text_add" placeholder="商品售价"></asp:TextBox>
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="请输入商品售价" ControlToValidate="txt_selling"></asp:RequiredFieldValidator>--%>

                        </span>
                        <div class="prompt r_f"></div>
                    </li>
                    <li>
                        <label class="label_name">产地：</label><span class="add_name">
                            <asp:TextBox ID="txt_productionPlace" lname="商品产地" runat="server" class="text_add" placeholder="产地"></asp:TextBox>
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="请输入产地" ControlToValidate="txt_productionPlace"></asp:RequiredFieldValidator>--%>
                        </span>
                        <div class="prompt r_f"></div>
                    </li>

                    <li>
                        <label class="label_name">商品库存：</label><span class="add_name">
                            <asp:TextBox ID="txt_stocks" lname="商品库存" runat="server" class="text_add" placeholder="商品库存"></asp:TextBox>
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="请输入商品库存" ControlToValidate="txt_stocks"></asp:RequiredFieldValidator>--%>
                        </span>
                        <div class="prompt r_f"></div>
                    </li>

                    <li class="adderss">
                        <label class="label_name">已售数量：</label><span class="add_name">
                            <asp:TextBox ID="txt_quantitySold" lname="已售数量" runat="server" class="text_add" placeholder="已售数量"></asp:TextBox>
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="请输入已售数量" ControlToValidate="txt_quantitySold"></asp:RequiredFieldValidator>--%>
                        </span>
                        <div class="prompt r_f"></div>
                    </li>
                    <li class="adderss">
                        <label class="label_name">商品类别：</label><span class="add_name">
                            <asp:DropDownList ID="ddl_Add" runat="server" class="text_add" Style="margin-left: 10px;"></asp:DropDownList>

                        </span>
                        <div class="prompt r_f"></div>
                    </li>
                    <li class="adderss">
                        <label class="label_name">商品描述：</label><span class="add_name">
                            <asp:TextBox ID="txt_description" lname="商品描述" runat="server" class="text_add" placeholder="商品描述" TextMode="MultiLine" Width="542px" Height="200px"></asp:TextBox>
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ErrorMessage="请输入商品描述" ControlToValidate="txt_description"></asp:RequiredFieldValidator>--%>
                        </span>
                        <div class="prompt r_f"></div>
                    </li>


                    <li class="adderss" style="text-align: center; margin-top: 190px">
                        <%--<asp:Button ID="btn_add" runat="server" Text="添加" class="btn btn-primary radius" OnClick="btn_add_Click" />--%>
                        <input id="btn_add" value="添加" class="btn btn-primary radius" type="button"/>
                        <%--<asp:Button ID="btn_clear" runat="server" Text="重置" class="btn btn-primary radius btnClear"/>--%>
                        <input type="button" id="btn_clear" value="重置" class="btn btn-primary radius" />
                        <div class="prompt r_f"></div>
                    </li>
                </ul>

            </div>

        </div>
    </form>

</body>
</html>
<script>
    jQuery(function ($) {
        var oTable1 = $('#sample-table').dataTable({
            "aaSorting": [[1, "desc"]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                { "orderable": false, "aTargets": [0, 2, 3, 4, 5, 8, 9] }// 制定列不参与排序
            ]
        });


        $('table th input:checkbox').on('click', function () {
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function () {
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });

        });


        $('[data-rel="tooltip"]').tooltip({ placement: tooltip_placement });
        function tooltip_placement(context, source) {
            var $source = $(source);
            var $parent = $source.closest('table')
            var off1 = $parent.offset();
            var w1 = $parent.width();

            var off2 = $source.offset();
            var w2 = $source.width();

            if (parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
            return 'left';
        }
    });
    laydate({
        elem: '#start',
        event: 'focus'
    });
    $(function () {
        $("#products_style").fix({
            float: 'left',
            //minStatue : true,
            skin: 'green',
            durationTime: false,
            spacingw: 30,//设置隐藏时的距离
            spacingh: 260,//设置显示时间距
        });
        
    });
</script>
<script type="text/javascript">
    //初始化宽度、高度  
    $(".widget-box").height($(window).height() - 215);
    $(".table_menu_list").width($(window).width() - 260);
    $(".table_menu_list").height($(window).height() - 215);
    //当文档窗口发生改变时 触发  
    $(window).resize(function () {
        $(".widget-box").height($(window).height() - 215);
        $(".table_menu_list").width($(window).width() - 260);
        $(".table_menu_list").height($(window).height() - 215);
    })

    /*******树状图*******/
    var setting = {
        view: {
            dblClickExpand: false,
            showLine: false,
            selectedMulti: false
        },
        data: {
            simpleData: {
                enable: true,
                idKey: "id",
                pIdKey: "pId",
                rootPId: ""
            }
        },
        callback: {
            beforeClick: function (treeId, treeNode) {
                var zTree = $.fn.zTree.getZTreeObj("tree");
                if (treeNode.isParent) {
                    zTree.expandNode(treeNode);
                    return false;
                } else {
                    demoIframe.attr("src", treeNode.file + ".html");
                    return true;
                }
            }
        }
    };

    var zNodes = [
        { id: 1, pId: 0, name: "商城分类列表", open: true },
        { id: 11, pId: 1, name: "蔬菜水果" },
        { id: 111, pId: 11, name: "蔬菜" },
        { id: 112, pId: 11, name: "苹果" },
        { id: 113, pId: 11, name: "大蒜" },
        { id: 114, pId: 11, name: "白菜" },
        { id: 115, pId: 11, name: "青菜" },
        { id: 12, pId: 1, name: "手机数码" },
        { id: 121, pId: 12, name: "手机 " },
        { id: 122, pId: 12, name: "照相机 " },
        { id: 13, pId: 1, name: "电脑配件" },
        { id: 131, pId: 13, name: "手机 " },
        { id: 122, pId: 13, name: "照相机 " },
        { id: 14, pId: 1, name: "服装鞋帽" },
        { id: 141, pId: 14, name: "手机 " },
        { id: 42, pId: 14, name: "照相机 " },
    ];

    var code;

    function showCode(str) {
        if (!code) code = $("#code");
        code.empty();
        code.append("<li>" + str + "</li>");
    }

    $(document).ready(function () {
        var t = $("#treeDemo");
        t = $.fn.zTree.init(t, setting, zNodes);
        demoIframe = $("#testIframe");
        demoIframe.bind("load", loadReady);
        var zTree = $.fn.zTree.getZTreeObj("tree");
        zTree.selectNode(zTree.getNodeByParam("id", '11'));
    });
    /*产品-停用*/
    function member_stop(obj, id) {
        layer.confirm('确认要停用吗？', function (index) {
            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" class="btn btn-xs " onClick="member_start(this,id)" href="javascript:;" title="启用"><i class="icon-ok bigger-120"></i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已停用</span>');
            $(obj).remove();
            layer.msg('已停用!', { icon: 5, time: 1000 });
        });
    }

    /*产品-启用*/
    function member_start(obj, id) {
        layer.confirm('确认要启用吗？', function (index) {
            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" class="btn btn-xs btn-success" onClick="member_stop(this,id)" href="javascript:;" title="停用"><i class="icon-ok bigger-120"></i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
            $(obj).remove();
            layer.msg('已启用!', { icon: 6, time: 1000 });
        });
    }
    /*产品-编辑*/
    function member_edit(title, url, id, w, h) {
        layer_show(title, url, w, h);
    }

    /*产品-删除*/
    function member_del(obj, id) {
        layer.confirm('确认要删除吗？', function (index) {
            $(obj).parents("tr").remove();
            layer.msg('已删除!', { icon: 1, time: 1000 });
        });
    }
    //面包屑返回值
    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.iframeAuto(index);
    $('.Order_form').on('click', function () {
        var cname = $(this).attr("title");
        var chref = $(this).attr("href");
        var cnames = parent.$('.Current_page').html();
        var herf = parent.$("#iframe").attr("src");
        parent.$('#parentIframe').html(cname);
        parent.$('#iframe').attr("src", chref).ready();;
        parent.$('#parentIframe').css("display", "inline-block");
        parent.$('.Current_page').attr({ "name": herf, "href": "javascript:void(0)" }).css({ "color": "#4c8fbd", "cursor": "pointer" });
        //parent.$('.Current_page').html("<a href='javascript:void(0)' name="+herf+" class='iframeurl'>" + cnames + "</a>");
        parent.layer.close(index);

    });

    /*添加商品*/

    jQuery(function ($) {
        var oTable1 = $('#sample-table').dataTable({
            "aaSorting": [[1, "desc"]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                { "orderable": false, "aTargets": [0, 8, 9] }// 制定列不参与排序
            ]
        });


        $('table th input:checkbox').on('click', function () {
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function () {
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });

        });


        $('[data-rel="tooltip"]').tooltip({ placement: tooltip_placement });
        function tooltip_placement(context, source) {
            var $source = $(source);
            var $parent = $source.closest('table')
            var off1 = $parent.offset();
            var w1 = $parent.width();

            var off2 = $source.offset();
            var w2 = $source.width();

            if (parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
            return 'left';
        }
    })
    /*用户-添加*/
    $('#member_add').on('click', function () {
        layer.open({
            type: 1,
            title: '添加商品',
            maxmin: true,
            shadeClose: true, //点击遮罩关闭层
            area: ['800px', ''],
            content: $('#add_menber_style'),
            end: function () {
                ClearText();
            }
        });
    });
    /*用户-查看*/
    function member_show(title, url, id, w, h) {
        layer_show(title, url + '#?=' + id, w, h);
    }
    /*用户-停用*/
    function member_stop(obj, id) {
        layer.confirm('确认要停用吗？', function (index) {
            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" class="btn btn-xs " onClick="member_start(this,id)" href="javascript:;" title="启用"><i class="icon-ok bigger-120"></i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已停用</span>');
            $(obj).remove();
            layer.msg('已停用!', { icon: 5, time: 1000 });
        });
    }

    /*用户-启用*/
    function member_start(obj, id) {
        layer.confirm('确认要启用吗？', function (index) {
            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" class="btn btn-xs btn-success" onClick="member_stop(this,id)" href="javascript:;" title="停用"><i class="icon-ok bigger-120"></i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
            $(obj).remove();
            layer.msg('已启用!', { icon: 6, time: 1000 });
        });
    }
    /*用户-编辑*/
    function member_edit(id) {
        layer.open({
            type: 1,
            title: '修改用户信息',
            maxmin: true,
            shadeClose: false, //点击遮罩关闭层
            area: ['800px', ''],
            content: $('#add_menber_style'),
            btn: ['提交', '取消'],
            yes: function (index, layero) {
                var num = 0;
                var str = "";
                $(".add_menber input[type$='text']").each(function (n) {
                    if ($(this).val() == "") {

                        layer.alert(str += "" + $(this).attr("name") + "不能为空！\r\n", {
                            title: '提示框',
                            icon: 0,
                        });
                        num++;
                        return false;
                    }
                });
                if (num > 0) { return false; }
                else {
                    layer.alert('添加成功！', {
                        title: '提示框',
                        icon: 1,
                    });
                    layer.close(index);
                }
            }
        });
    }
    /*用户-删除*/
    function member_del(obj, id) {
        layer.confirm('确认要删除吗？', function (index) {
            $(obj).parents("tr").remove();
            layer.msg('已删除!', { icon: 1, time: 1000 });
        });
    }
    laydate({
        elem: '#start',
        event: 'focus'
    });


    function ClearText() {
        $('#txt_number').val("");
        $('#txt_nam').val("");
        $('#txt_purchase').val("");
        $('#txt_selling').val("");
        $('#txt_productionPlace').val("");
        $('#txt_stocks').val("");
        $('#txt_quantitySold').val("");
        $('#txt_description').val("");

    }


</script>

